package main

import (
	"thirdpaysdk/api/qcurepay"
	"fmt"
)

func main() {
    
	appsecret := "66E0FE1058BA4E38AC6551BC78B7267E"
	/*
	subAppid := "wx75e97ad177e2c05f"
	orgCode := "66600196"
	merchCode := "QP0088880000005"
	notifyUrl := "https://api.dhfapp.com" + "/public/qcurepay/notify"
	
	merchOrderNo := "123456789106"
	subOpenId := "oJlHX5WOo6v_iptoKxkYQ7DyEN1I"
	attach := "测试单据"
	amount := 2
	qcurepay.MicroAppPay(orgCode,merchCode,appsecret,merchOrderNo,attach,subAppid,subOpenId,notifyUrl,amount)
	*/
	
	notifyData := `{"amount":"2","createTime":"2019-03-28 18:45:43","merchCode":"QP0088880000005","merchOrderNo":"331211832553377792","orderNo":"HKDF937182982033883136","orgCode":"66600196","payTime":"2019-03-28 18:45:48","payType":"wxgjpay_public","remark":"订单[331211832553377792]","respCode":"00","respMsg":"成功","sign":"D017003BA64422495190494939BAA076","version":"V1.0"}`
	
	rspMap, err := qcurepay.ParseQcureNotify([]byte(notifyData))
	if err != nil {
	    fmt.Println("ParseQcureNotify:", err.Error())
		return
	}
	_, err = qcurepay.VerifyQcureSign(rspMap, appsecret)
	if err != nil {
	    fmt.Println("VerifyQcureSign:", err.Error())
		return
	}
}
